import { GRID_OVERLAY_DEFAULTS } from './constants.js';
export const hiddenBaseCanvas = document.createElement('canvas');
export const hiddenBaseCtx = hiddenBaseCanvas.getContext('2d');
export const state = {
  width: 0,
  height: 0,
  defaultCellSize: 10,
  pixelRatio: 10,
  cellSize: 10,
  zoomValue: 10,
  zoomScale: 1,
  grid: [],
  palette: {},
  paletteKeys: [],
  selectedColorKey: null,
  showCodes: false,
  autoSnap: false,
  baseImage: null,
  baseImageData: null,
  baseImageName: null,
  baseScale: 1,
  baseOffsetX: 0,
  baseOffsetY: 0,
  baseLayerPosition: 'under',
  baseEditing: false,
  backgroundOpacity: 0.9,
  createdAt: null,
  panX: 0,
  panY: 0,
  lastMiddleClickTime: 0,
  currentTool: 'pencil',
  previousTool: 'pencil',
  activePanel: 'canvas-settings',
  paletteLibrary: new Map(),
  paletteOrder: [],
  currentPaletteId: null,
  currentPaletteLabel: '',
  axisPadding: { top: 0, right: 0, bottom: 0, left: 0 },
  normalColorKeys: [],
  specialColorKeys: [],
  updateVisible: false,
  referenceImages: [],
  referenceWindowVisible: false,
  referenceWindowMinimized: false,
  referenceWindowRect: { width: 320, height: 420, top: 24, left: null },
  referenceWindowPrevRect: null,
  history: [],
  historyIndex: -1,
  maxHistorySize: 50,
  exportVisible: false,
  exportSettings: {
    format: 'image/png',
    includeCodes: false,
    includeAxes: false,
    includeLightColors: true,
    includeTemperatureColors: true,
    backgroundType: 'solid',
    backgroundColor: '#ffffff',
    filename: ''
  },
  displayMode: 'standard',
  simpleMode: false,
  pixelShape: 'square',
  symmetryMode: 'none',
  axisOpacity: 1,
  gridOverlay: { ...GRID_OVERLAY_DEFAULTS },
  selection: {
    active: false,
    mask: null,
    bounds: null,
    preview: null
  }
};
